package com.zzyl.nursing.mapper.member;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.nursing.domain.Reservation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface IMemberReservationMapper extends BaseMapper<Reservation> {

    // 查询当天的取消预约次数
    @Select("select count(1) from reservation where create_by = #{userId} and status = 2 AND create_time BETWEEN #{start} AND #{end}")
    Integer cancelledCount(@Param("userId") Long userId, @Param("start") LocalDateTime startOfDay,@Param("end") LocalDateTime endOfDay);
}
